class BlockChain:
    def __init__(self):
        self.chain = []
        self.tailHash = ''
        self.block_height = 0


'''区块上链'''
def store(block, chain):
    block.blockHeader.parentHash = chain.tailHash
    block.rlp()
    chain.chain.append(block)
    chain.block_height += 1
    chain.tailHash = block.blockBody.hash
    '''打印日志'''
    print('parent hash: ', block.blockHeader.parentHash)
    print('hash: ', chain.tailHash)
    print('Block height: ', chain.block_height)


'''删除交易'''
def deleteTransactions(block, pool):
    txs = block.blockBody.transactions
    for tx in txs:
        for tx_e in pool.pool:
            if tx_e.nonce == tx.nonce:
                pool.remove(tx_e)